Practical Artificial Intelligence with Swift by Tim Nugent & Paris Buttfield-Addison & Jonathon Manning & Mars Geldard

Practical Artificial Intelligence with Swift by Tim Nugent & Paris Buttfield-Addison & Jonathon Manning & Mars Geldard

Author:Tim Nugent & Paris Buttfield-Addison & Jonathon Manning & Mars Geldard [Tim Nugent]
Language: eng
Format: epub, azw3
Publisher: O'Reilly Media, Inc.
Published: 2019-10-22T16:00:00+00:00


First, let’s make some changes to the enum for Sentiment.swifts, Sentiment:

Add an extra case at the beginning of the Sentiment enum, with the extra line covering a lack of sentiment:

case positive = "Positive" case negative = "Negative" case neutral = "None"

Similarly, add a default case to the switch statement in the icon variable, to account for a lack of sentiment:

var icon: String { switch self { case .positive: return "" case .negative: return "" default: return "" } }

For the color, return gray if there’s no sentiment found:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.